package com.jinzihan.dao.impl;

import com.jinzihan.dao.StudentDao;
import com.jinzihan.entity.Student;

public class StudentDaoImpl extends BaseDao implements StudentDao {

    @Override
    public Student queryStudentByUsername(String username) {
        String sql = "select `username`,`password`,`student_id` studentId from t_student where `username` = ? ";
        return queryForOne(Student.class,sql,username);
    }

    @Override
    public Student queryStudentByUsernameAndPassword(String username, String password) {
        String sql = "select `username`,`password`,`student_id` studentId from t_student where `username` = ? and `password` = ?";
        return queryForOne(Student.class,sql,username,password);
    }

    @Override
    public Student queryStudentById(Integer id) {
        String sql = "select `username`,`password`,`student_id` studentId from t_student where student_id = ?";
        return queryForOne(Student.class,sql,id);
    }

}
